<!DOCTYPE html>
<html lang="en" style="font-size: 37.5px">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>rem适配的第二种思路</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        #banner{
            width: 8.933rem;
            height: 3.84rem;
            margin: 2.587rem auto;
            background: #c89;
        }
    </style>
</head>
<body>
    <div id="banner">

    </div>

    <script>
    function adapter(){
        //设置根标签的 font-size 值
        let fontSize = document.documentElement.clientWidth / 10;
        document.documentElement.style.fontSize = fontSize + 'px';
    }
    adapter();

    window.onresize = adapter;
    </script>
</body>
</html>